// 将一个表单的数据封装成js的Object对象
$.fn.getFormData = function() {
	var o = {};
	var a = this.serializeArray();
	$.each(a, function() {
		if (o[this.name]) {
			if (!o[this.name].push) {
				o[this.name] = [ o[this.name] ];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

function dump(arr,level) {
    var dumped_text = "";
    if(!level) level = 0;

    //The padding given at the beginning of the line.
    var level_padding = "";
    for(var j=0;j<level+1;j++) level_padding += "    ";

    if(typeof(arr) == 'object') { //Array/Hashes/Objects
        for(var item in arr) {
            var value = arr[item];

            if(typeof(value) == 'object') { //If it is an array,
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += dump(value,level+1);
            } else {
                dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
            }
        }
    } else { //Stings/Chars/Numbers etc.
        dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
    }
    return dumped_text;
}

//禁用提交按钮并置灰
$.fn.disableSubmitBtn=function(){	
	this[0].oldClassName=this[0].className;
	this[0].className="btn-gray-2";	
	this.attr("disabled","disabled");
}

//启用提交按钮并去灰
$.fn.enableSubmitBtn=function(){
	this[0].className=this[0].oldClassName;	
	this.removeAttr("disabled");
}

var sign = function(formId){
    var formData = $("#"+formId).getFormData();
    $.get(ctx+"/sign.shtml", formData, function(data) {

    });
}